/*
 *Program Name: Drawable.cpp
 *Written By:   Cheng-Hsiu Hsieh
 */

#include "Drawable.h"
#include "SharedConstants.h"
#include "corona/corona.h"
#include <GL/glut.h>
#include <math.h>

//every drawable should have this property

cDrawable::cDrawable():
mXPosition(0),
mYPosition(0),
mZPosition(0),
mRadius(0),
mHide( false)
{

}

cDrawable::cDrawable( float fRadius ):
mXPosition(0),
mYPosition(0),
mZPosition(0),
mRadius( fRadius ),
mHide( false)
{
}
cDrawable::~cDrawable()
{
}

bool cDrawable::hasCollided( cDrawable* Objects )
{
  return ( ( abs( this->getXPosition() - 
                  Objects->getXPosition() ) - 
             this->getRadius() - Objects->getRadius() ) < 0 );
}

void cDrawable::setXPosition( float x )
{
  mXPosition = x;
}

void cDrawable::setYPosition( float y )
{
  mYPosition = y;
}

void cDrawable::setZPosition( float z )
{
  mZPosition = z;
}

void cDrawable::setRadius( float r )
{
  mRadius = r;
}

void cDrawable::setHide( bool bSwitch )
{
  mHide = bSwitch;
}

float cDrawable::getXPosition()
{
  return mXPosition;
}

float cDrawable::getYPosition()
{
  return mYPosition;
}

float cDrawable::getZPosition()
{
  return mZPosition;
}

float cDrawable::getRadius()
{
  return mRadius;
}

bool cDrawable::getHide()
{
  return mHide;
}

void cDrawable::Move(float x, float y, float z)
{
	mXPosition += x;
  mYPosition += y;
	mZPosition += z;
}

void cDrawable::MoveTo(float x, float y, float z)
{
	mXPosition = x;
  mYPosition = y;
	mZPosition = z;
}

